package ComDirectBehaviour;

import java.io.IOException;
import java.util.ArrayList;

import Message.MEnnemie;
import Message.MState;
import Message.ReqReparation;
import jade.core.AID;
import jade.core.behaviours.Behaviour;
import jade.lang.acl.ACLMessage;
import jade.lang.acl.UnreadableException;
import Goal.GoalBase;
import Perception.PerceptsBase;
import Perception.Percepts;
import Message.MNoeud;
import Message.MEnnemie;
import Message.MReparationOK;
/**
 * TODO description
 */
public class ComInfoExp extends Behaviour {

	
	public void checkMessage(ACLMessage msg)
	{
		original(msg);
		checkInfo(msg);
	}
	
	public void checkInfo(ACLMessage msg)
	{
		try{
			String id =msg.getConversationId(); 
			if(id.equals("Noeud"))
			{
				MNoeud noeud = (MNoeud)msg.getContentObject();
				goals.removeGoal("Probe-"+noeud.getNoeud());
			}
			else if(id.equals("Prob"))
			{
				MNoeud noeud = (MNoeud)msg.getContentObject();
				goals.addGoal("Probe-"+noeud.getNoeud());
			}
		}
		catch(UnreadableException e)
		{
			System.err.println(e.getMessage());
		}
		
	}
	
}